import { AxiosPromise } from "axios";
import request from "@/utils/request";
import { FreebackQuery, FreebackPageVO, FreebackForms } from "./types";

/**
 * 获取意见反馈分页列表
 *
 * @param queryParams
 */
export function getFreebackPage(
  queryParams?: FreebackQuery
): AxiosPromise<PageResult<FreebackPageVO[]>> {
  return request({
    url: "/api/feedback/page",
    method: "get",
    params: queryParams,
  });
}

/**
 * 删除意见反馈
 *
 * @param id
 */
export function deleteFreeback(id: string) {
  return request({
    url: "/api/feedback/delete?id=" + id,
    method: "post",
  });
}

/**
 * 添加
 *
 * @param data
 */
export function addFreeback(data: FreebackForms) {
  return request({
    url: "/api/feedback/add",
    method: "post",
    data: data,
  });
}

/**
 * 更新
 *
 * @param id
 * @param data
 */
export function updateFreeback(id: string, data: FreebackForms) {
  return request({
    url: "/api/feedback/update?id=" + id,
    method: "put",
    data: data,
  });
}
